package cn.devices.controller;


import cn.devices.entity.TbMenu;
import cn.devices.model.JsonMessage;
import cn.devices.service.TbMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 路由表 前端控制器
 * </p>
 *
 * @author 秋水浮萍
 * @since 2021-02-09
 */
@RestController
@RequestMapping("/tb-menu")
public class TbMenuController {

    @Autowired
    private TbMenuService tbMenuService;

    @GetMapping("tbMenuList")
    public JsonMessage tbMenuList() {
        JsonMessage message = new JsonMessage();
        List<TbMenu> tbMenuList=tbMenuService.tbMenuList();
        List<String> list=new ArrayList<>();
        for (TbMenu tbMenu : tbMenuList){
            list.add(tbMenu.getMenuPath());
        }
        message.setData(list);
        return message;
    }
}
